/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: hp
 * Date: 2024-02-06
 * Time: 22:59
 */
public class Test {
    public static void func(int n) {
        if(n < 10) {
            System.out.println(n);
        }
        else {
            func(n/10);
            System.out.println(n%10);
        }
    }
    public static int func1(int n) {
        if(n < 10) {
            return n;
        }
        return n % 10 + func1(n/10);
    }
    public static void main(String[] args) {
        System.out.println(func1(123));
    }
}
